package callback;

import javax.swing.JOptionPane;

import pojo.*;
import transfer.JoinRoomData;
import client.Client;

public class ChooseRoomCallback extends ClientCallback{

	private ChessOnlineRoom mRoom;
	
	public ChooseRoomCallback(Client client, ChessOnlineRoom room) {
		super(client);
		this.mRoom = room;
	}
	
	@Override
	public void perform() {
		// TODO: Check the server if it can to join this room
		// if can, we need to save the League ID if any
		if(mRoom.getPlayerB() == null){
			mMainScreen.getCw().sendObject(new JoinRoomData("Join Room", mRoom.getRoomId(), mMainScreen.getAcc()));
		}
		else{
			JOptionPane.showMessageDialog(null, "Room Full!!");
		}
		//mMainScreen.showRoomView(mRoom);
	}
	
}
